package besta.moon.sql.expression.function.string;

import besta.moon.sql.expression.function.FunctionReturnP1StringAndBinary;
import besta.moon.sql.parser.SQLTokenizer;

public class FunctionUCase extends FunctionReturnP1StringAndBinary {

    @Override
    public final int getFunction() {
        return SQLTokenizer.UCASE;
    }

    @Override
    public final boolean isNull() throws Exception {
        return param1.isNull();
    }

    @Override
    public final byte[] getBytes() throws Exception {
        if (isNull()) {
            return null;
        }
        return getString().getBytes();
    }

    @Override
    public final String getString() throws Exception {
        if (isNull()) {
            return null;
        }
        return param1.getString().toUpperCase();
    }
}
